package com.bw.ppjokeplay.mvvm.view.home

import android.os.Bundle
import android.view.View
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import com.blankj.utilcode.util.LogUtils
import com.bumptech.glide.Glide
import com.bw.ppjokeplay.BR
import com.bw.ppjokeplay.R
import com.bw.ppjokeplay.commen.mvvm.view.BaseActivity
import com.bw.ppjokeplay.databinding.ActivityCommentsBinding
import com.bw.ppjokeplay.mvvm.viewmodel.home.CommentsViewModel
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer

/**
 * @author Lishaohe
 * @description:
 * @date :2021/11/11 0011 下午 1:11
 *
 */
class Commentsactivity: BaseActivity<ActivityCommentsBinding, CommentsViewModel>() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val bottom = findViewById<TextView>(R.id.input_view)
        val bottom_view = findViewById<RelativeLayout>(R.id.bottom_view)
        val gone_view = findViewById<View>(R.id.gone_view)
        val avatar = findViewById<ImageView>(R.id.avatar)
        val list_player_view = findViewById<StandardGSYVideoPlayer>(R.id.list_player_view)
        bottom.setOnClickListener {
            bottom_view.visibility = View.VISIBLE
        }
        gone_view.setOnClickListener {
            bottom_view.visibility = View.GONE
        }

        val head = intent.extras!!.get("head")
        val name = intent.extras!!.get("name")
        val text = intent.extras!!.get("text")
        val description = intent.extras!!.get("description")
        val url = intent.extras!!.get("url")
        val id = intent.extras!!.get("id")
        val img = intent.extras!!.get("img")
        LogUtils.e(head,name,text,description,url)
        Glide.with(this).load(head).circleCrop().into(avatar)
        list_player_view.setUp(url as String?,false,"")
        val imageView = ImageView(this)
        imageView.scaleType=ImageView.ScaleType.CENTER_CROP
        Glide.with(this).load(img).into(imageView)
        list_player_view.thumbImageView = imageView
        vm.vis(id,head,name,text,description,url)
    }
    override fun bindLayout(): Int {
        return R.layout.activity_comments

    }

    override fun initVerable(): Int {
        return BR.comments
    }


}